package parser.nodes;

import java.util.ArrayList;
import java.util.List;
import scanner.Token;

// ProcedureHeading = 'PROCEDURE' ident '(' [FormalParameters] ')'
public class ProcedureHeadingNode extends Node {
    private Token procName;
    private FormalParametersNode params;

    public ProcedureHeadingNode(Token procName) {
        this.procName = procName;
    }

    public ProcedureHeadingNode(Token procName, FormalParametersNode params) {
        this.procName = procName;
        this.params = params;
    }
    
    public Token getProcName() {
        return procName;
    }
    
    public List<FPSectionNode> getParams() {
        if (params != null)
            return params.getSections();
        return new ArrayList<FPSectionNode>();
    }
    
    @Override
    public void print() {
        p("ProcedureHeading:");
        indent();
        p("PROCEDURE " + procName);
        p("(");
        if (params != null)
            params.print();
        p(")");
        unindent();
    }

    @Override
    public void abstractPrint() {
        p(procName);
        params.abstractPrint();
    }

    
}
